



from flask import render_template
from flask import Flask, render_template, redirect, url_for, request
import time

app = Flask(__name__,template_folder='./')

app.secret_key = '123'

@app.route('/')
@app.route('/index')
def index():
    user = {'nickname': 'Miguel'} # fake user
    return render_template("index.html",
        title = 'Home',
        user = user)     #这里模块里的第一个user指的是html里面的变量user，而第二个user指的是函数index里面的变量user

@app.route('/person')
def person():
    class Person(object):
        Email = 'XXX@XXX.com';
        time = time.time();

    dell=Person()

    context={
        'username':"王亚锋",
        'age': "18",
        'gender': "男",
        'flag': "王者",
        'hero': "猴子",
        'person':dell,
        'wwwurl':{
            'baidu':'www.baidu.com',
            'google':'www.google.com'
        }
    }
    return render_template('index2.html', **context)

if __name__ == '__main__':
    app.run(debug=True)
